import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
@Entity() // 使用 @Entity() 装饰器标记它为一个实体类
export class User {
  @PrimaryGeneratedColumn('increment') // 主键，自增
  id: number;

  @Column({
    nullable: false,
  }) // 普通字段
  user_name: string;

  @Column({
    nullable: false,
  })
  password: string;

  @Column({
    nullable: true,
  })
  permission: string;

  @Column({
    nullable: false,
    type: 'datetime',
    default: () => 'CURRENT_TIMESTAMP',
  })
  create_at: Date;

  @Column({
    nullable: true,
  })
  state: number;

  @Column({
    nullable: true,
  })
  is_admin: number;
}
